package cn.yesway.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.yesway.dao.UserDao;
import cn.yesway.entity.User;
import cn.yesway.service.UserService;

@Service
public class UserServiceImpl implements UserService {
	@Autowired
	private UserDao userDao;

	public int save(User user) {
		return userDao.save(user);
	}

	public User findByLoginName(String loginName) {
		return userDao.findByLoginName(loginName);
	}

	public User findByLoginNameAndPassword(String loginName, String password) {
		return userDao.findByLoginNameAndPassword(loginName, password);
	}

	public User findByUserId(long userId) {
		return userDao.findByUserId(userId);
	}

	public List<User> findAll() {
		return userDao.findAll();
	}

	public int getCount(Map<String, Object> map) {
		return userDao.getCount(map);
	}

	public List<User> findPageList(Map<String, Object> map) {
		return userDao.findPageList(map);
	}

	@Transactional
	public int update(User user) {
		return userDao.update(user);
	}

	public int delete(long userId) {
		return userDao.delete(userId);
	}
}
